package layoutTest;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Text;


public class GridLayoutTest2 extends Composite
{

	
	
	public GridLayoutTest2(Composite parent) 
	{
		super(parent, SWT.NONE);
		
		try
		{
			initComposite(parent);
			
			 
			
		}
		catch (Exception e) 
		{
			
		}
		finally
		{
			
		}
		
	}
	
	private void initComposite(Composite parent)
	{
		

		Layout layout = null;
		GridData layoutDataBoth34 = null;
		GridData layoutDataHorizon2 = null;
		GridData layoutDataVertical2 = null;
		
		
		Button[] button = new Button[5];
		
		Text textField = null;
		
		try
		{
			layout = new GridLayout(4, false);
			
			this.setLayout(layout);
			
			for(int i = 0 ; i < 3 ; i++)
			{
				button[i] = new Button(this, SWT.NONE);
				button[i].setText( (i + 1) +" Button");
				
				
			}
			
			layoutDataHorizon2 = new GridData(GridData.FILL_HORIZONTAL);
			layoutDataHorizon2.horizontalSpan = 2;
			button[1].setLayoutData(layoutDataHorizon2);
			
			
			
			textField = new Text(this, SWT.BORDER|SWT.MULTI|SWT.V_SCROLL);
			
			
			layoutDataBoth34 = new GridData(GridData.FILL_BOTH);
			layoutDataBoth34.horizontalSpan = 3;
			layoutDataBoth34.verticalSpan = 4;
			
			textField.setLayoutData(layoutDataBoth34);		
			
			
			layoutDataVertical2 = new GridData(GridData.FILL_VERTICAL);
			layoutDataVertical2.verticalSpan = 2;
			
			
			for(int i = 3 ; i < button.length ; i++)
			{
				button[i] = new Button(this, SWT.NONE);
				button[i].setText( (i + 1) +" Button");
				button[i].setLayoutData(layoutDataVertical2);
				
			}
			
			

			

			this.pack();
			
		}
		catch (Exception e) 
		{
			
		}
		finally
		{
			
		}
	}

}
